package leetCode;

/**
 * @author hanj.cn@outlook.com
 */
public class IsPalindrome {

    public static void main(String[] args) {

        int x = 11;
        System.out.println(isPalindrome(x));
    }

    public static boolean isPalindrome(int x) {

        if (x < 0) {
            return false;
        }
        if (x <= 9) {
            return true;
        }
        String str = x + "";
        for (int i = 0; i < str.length() / 2; i++) {
            if (str.substring(i, i + 1).equals(str.substring(str.length() - i - 1, str.length() - i))) {
            } else {
                return false;
            }
        }
        return true;
    }

}
